<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
    <title><?php echo getStoreName($_GET['local_id']);?>-商品列表</title>
    <link rel="stylesheet" href="/Public/Home/css/category.css?v=20170317001">
    <!--不识别数字为手机-->
<meta name="format-detection" content="telephone=no, email=no"/>
<!--通用js-->
<?php if(isset($signPackage) && !empty($signPackage)){ ?>
<script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js?v=201704270010"></script>
<?php } ?>
<script type="text/javascript" src="/Public/Home/js/require.js"></script>
<script type="text/javascript" src="/Public/Home/js/baseLoading.js?v=201705240001"></script>
<script src="/Public/Home/js/jquery.min.js" ></script>
<script src="/Public/Home/js/pincode-input.js" ></script>
<script src="/Public/Home/js/parabola.js" ></script>
<script src="/Public/Home/js/lazyload/jquery.lazyload.min.js"></script>
<script type="text/javascript">
    _global.isLogin = !!"<?php echo $wx_member_id; ?>";
	var isWxShareDiy = typeof yc_share_diy === "undefined" ? false : yc_share_diy;
	var yc_wx_shareImgPath = "";
	<?php if(isset($weixin_logo) && !empty($weixin_logo)){ ?>
		yc_wx_shareImgPath = "/Uploads/<?php echo ($weixin_logo["image"]); ?>";
	<?php } ?>
    var yc_pass_arr = {'local_id':"<?php echo I('local_id',1);?>",'top_local_id':"<?php echo I('top_local_id',1);?>"};
	if(parseInt(yc_pass_arr["local_id"]) == 21){
		_global.isStopSell = true;
	}
    <?php if(isset($signPackage) && !empty($signPackage)){ ?>
        _global.isWeiXinLoad = true;
        var isEnableLocation = typeof yc_wx_location === "undefined" ? false : yc_wx_location;
        var yc_wx_options = {
            "enableLocation" : isEnableLocation,
            "refuseCallback" : function(){},
            "mapCallback" : function(){},
            "config" : {
                debug: false,
                appId: '<?php echo $signPackage["appId"];?>',
                timestamp: '<?php echo $signPackage["timestamp"];?>',
                nonceStr: '<?php echo $signPackage["nonceStr"];?>',
                signature: '<?php echo $signPackage["signature"];?>',
                jsApiList: [
                    'checkJsApi'
                ]
            }
        };
        var isInHeader = typeof yc_wx_useInHeader === "undefined" ? true : yc_wx_useInHeader;
        if(isInHeader){
            wxAutoConfig(yc_wx_options);
        }
    <?php } ?>
</script>
</head>
<body>
<div class="warp">
    <div class="category-goods">
        <!-- 分类菜单 -->
        <div class="sort-bar clearfix">
            <ul>
                <li class="active"><a href="javascript:void(0);">全部</a></li>
                <li><a href="javascript:void(0);">默认排序</a></li>
                <li><a href="javascript:void(0);">筛选</a></li>
            </ul>
            <!-- 弹窗选择 -->
            <div class="full-select full-select-category tips">
                <a category-id='' href="javascript:void(0)">全部</a>
            </div>
            <div class="full-select tips">
                <a sort="1" href="javascript:void(0)">默认排序</a>
                <a sort="2" href="javascript:void(0)">销量</a>
                <a sort="3" href="javascript:void(0)">评价</a>
                <a sort="4" href="javascript:void(0)">价格最高</a>
                <a sort="5" href="javascript:void(0)">价格最低</a>
            </div>
            <div class="filter-select tips">
                <a select="1" href="javascript:void(0)">促销</a>
                <a select="2" href="javascript:void(0)">套餐</a>
            </div>
        </div>
        <!-- 筛选结果 -->
        <div class="filter-goods-list"><ul></ul></div>
        <div class="empty-box" style="display: none;">
            <img src="/Public/Home/images/iconEmpty.png" alt="">
            <p>没有找到您要的商品</p>
        </div>
        <!--<div class="item-more">
            <?php echo ($show); ?>
        </div>-->
    </div>
</div>
<link rel="stylesheet" href="/Public/Home/css/phoneCheck.css">
<div class="alert-popup bindPhone">
    <p>你还没有绑定手机号，为了你更好的体验怡臣请先绑定手机号。</p>
    <p><a href="javascript:void(0);" class="cancel">先看看</a><a href="javascript:void(0);" class="confirm">绑定手机</a></p>
</div>
<div class="bindPhone-box" style="display:none">
    <span class="close"></span>
    <div class="inputInfo">
        <h1>验证手机号</h1>
        <ul>
            <li><input type="text" placeholder="请输入绑定手机号" id="phone"> <a href="javascript:void(0);" id="yzCaptcha">获取验证码</a></li>
            <li>
                <div class="pincode-input-container touch" id="pincode-list">
                    <div style="display: none;">
                        <input type="password" readonly pattern="[0-9]*" inputmode="numeric" id="preventautofill" autocomplete="off">
                    </div>
                    <div class="touchwrapper touch4">
                        <input type="password" pattern="[0-9]*" readonly inputmode="numeric" maxlength="4" autocomplete="off" class="form-control pincode-input-text">
                        <table class="touchtable">
                            <tbody>
                            <tr>
                                <td></td>
                                <td></td>
                                <td></td>
                                <td class="last"></td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                    <div class="text-danger pincode-input-error"></div>
                </div>
                <input type="text" id="code-input" style="display:none;">
                <p class="code-tips" style="display:none;"></p>
            </li>
        </ul>
    </div>
    <div class="success" style="display:none;">
        <ul>
            <li>
                <span>绑定成功!</span>
                <p>该窗口<i>3</i>秒后自动关闭</p>
            </li>
        </ul>
    </div>
</div>

<!-- 悬浮购物车 -->
<div class="suspend-cart" id="moveid">
    <p class="add-cart">
        <a href="<?php echo url('carts/cart');?>">
            <span id="unique-cart-number"><?php echo userCartNum();?></span>
        </a>
    </p>
</div>

<!-- 子类主菜单 -->
<div class="subclass-main-nav">
    <div class="subclass-main-on"><a href="javascript:void(0)"><span>快速导航</span></a></div>
</div>
<div class="subclass-main-menu" style="display: none;">
    <div class="subclass-main-off"><a href="javascript:void(0)" class="close"><span>快速导航</span></a></div>
    <div class="subclass-main-menu-demo">
        <a href="<?php echo url('store/index');?>" class="home active"><span></span><p>首页</p></a>
        <a href="<?php echo url('category/index');?>" class="category"><span></span><p>分类</p></a>

        <?php $qgs_id = ($_GET['local_id']=='11') ? $_GET['top_local_id'] : $_GET['local_id']; ?>
        <a href="<?php echo url('store/index', ['local_id' => '11','top_local_id' => $qgs_id]);?>" class="store-way active"><span></span><p>全国送</p></a>
        <a href="<?php echo url('carts/cart');?>" class="cart"><span></span><p>购物车</p></a>
        <a href="<?php echo url('Member/index');?>" class="mine"><span></span><p>我的</p></a>
    </div>         
</div>


<script type="text/javascript">
    var _cat_id = "<?php echo ($cat_id); ?>";
    require(['subClassMain']);
</script>
<script type="text/javascript" src="/Public/Home/js/goods/list.js?v=2017020270009"></script>
<script type="text/javascript">
    var cartNumber = $('#unique-cart-number').text();
    var curNumber = '';
    var num = 0;
    var isAjax = false;
    function drag(obj,parentNode){
        var obj = document.getElementById(obj);
        if(arguments.length == 1){
            var parentNode = window.self;
            var pWidth = parentNode.innerWidth,pHeight = parentNode.innerHeight;
        }else{
            var parentNode = document.getElementById(parentNode);
            var pWidth = parentNode.clientWidth,pHeight = parentNode.clientHeight;
        }
        obj.addEventListener('touchstart',function(event){
            //当只有一个手指时              .
            var touch = event.targetTouches[0];
            var disX = touch.clientX - obj.offsetLeft,disY = touch.clientY - obj.offsetTop;
            var oWidth = obj.offsetWidth,oHeight = obj.offsetHeight;

            obj.addEventListener('touchmove',function(event){
                if(event.touches.length == 1){
                    //禁止浏览器默认事
                    event.preventDefault();
                };
                var touch = event.targetTouches[0];
                obj.style.left = touch.clientX - disX  + 'px';
                obj.style.top = touch.clientY - disY + 'px';
                //左侧
                if(obj.offsetLeft <=0){
                    obj.style.left = 0;
                };
                //右侧
                if(obj.offsetLeft >= pWidth -oWidth){
                    obj.style.left =  pWidth - oWidth + 'px';
                };
                //上面
                if(obj.offsetTop <= 0){
                    obj.style.top = 0;
                };
                //下面
                if(obj.offsetTop >= pHeight - oHeight){
                    obj.style.top =  pHeight - oHeight + 'px';
                };
            });
            obj.addEventListener('touchend',function(event){
                //obj.removeEventListener('touchmove');
                //obj.removeEventListener('touchend');
            })
        });
    }

    drag('moveid');
    function addIntoCart(e,_self){
        var _self = $(_self);
        e.preventDefault();
        _global.checkPhoner.verifyfunc = function(rs){
            if(rs){
                addCartAjax(e,_self);
                return true;
            }else{
                return false;
            }
        };
        _global.checkPhoner.succfunc =function(){
            addCartAjax(e,_self);
        };
        _global.checkPhoner.run(e);
    }

    function  addCartAjax(e,_self){
        if(isAjax){
            return false;
        }
        var goodsInfo = {
            sid: _self.data('sid'),
            pid: _self.data('pid'),
            gid: _self.data('gid'),
            spid:_self.data('spid')
        };
        isAjax = true;
        $.ajax({
            url: '/home/carts/addcart'+getFixedExtraUrl(),
            type: 'post',
            data: {
                'pid': goodsInfo.pid,
                'buyNum': 1,
                'goods_id': goodsInfo.gid,
                'local_id': goodsInfo.sid,
                'spid': goodsInfo.spid,
                'action': 'plus'
            },
            dataType: 'json',
            success: function(data) {

                if(data.status == 2) {
                    _global.promote.alertPopup(data.msg);
                }else if(data.status == 0){
                    _global.promote.alertPopup(data.msg);
                    window.location.href=data.url;
                }else{
                    num++;
                    e.preventDefault();
                    curNumber = parseInt(getFixedFloat(cartNumber,num,'+'));
                    _self.addClass('active');
                    _self.find('label').addClass('animate');
                    setTimeout(function(){
                        _self.removeClass('active');
                        _self.find('label').removeClass('animate');
                        $('#unique-cart-number').text(curNumber);
                    },500);
                }
                isAjax = false;
            },
            error: function(err) {
                isAjax = false;
                _global.promote.alertPopup('服务器异常，请稍后重试！')
            }

        });

    }
</script>

</body>
</html>